class Solution:
def ratCat(self, n, k ,arr):
arr.sort()
cat = 0
pos = len(arr) - 1
ans = 0
while pos>-1 and cat < arr[pos]:
cat+= n - arr[pos]
pos-=1
ans+=1
return ans
obj = Solution()
t = int(input())
for _ in range(t):
n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
print(obj.ratCat(n, k, arr))
/// In the name of Allah
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define nl '\n'
typedef long long ll;
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
const int MX = 1e5+123;
void solve( )
{
ll n,k;
cin>>n>>k;
vector<ll>v(k);
for(ll i=0;i<k;i++)
{
cin>>v[i];
}
sort(v.rbegin(),v.rend());
ll cat=0,cnt=0;
cnt=0;
for(ll i=0;i<k;i++)
{
if(v[i]>cat)
{
cat+=(n-v[i]);
cnt++;
}
else break;
}
cout<<cnt<<nl;
}
int main()
{
fast
ll T;
cin>>T;
for(ll t=1;t<=T;t++)
{
solve();
}
return 0;
}
1713C - Build Permutation | 1699A - The Third Three Number Problem |
1617B - GCD Problem | 841A - Generous Kefa |
1690B - Array Decrements | 1692C - Where's the Bishop |
104A - Blackjack | 1438A - Specific Tastes of Andre |
1711C - Color the Picture | 1194C - From S To T |
110B - Lucky String | 1114A - Got Any Grapes |
224B - Array | 125B - Simple XML |
567B - Berland National Library | 431B - Shower Line |
282C - XOR and OR | 1582B - Luntik and Subsequences |
609A - Флеш-карты | 1207A - There Are Two Types Of Burgers |
371C - Hamburgers | 343B - Alternating Current |
758B - Blown Garland | 1681B - Card Trick |
1592A - Gamer Hemose | 493D - Vasya and Chess |
1485A - Add and Divide | 337B - Routine Problem |
1392D - Omkar and Bed Wars | 76E - Points |